package Application.controller;

import java.util.List;

import javax.annotation.Resource;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import Application.entity.Discuss;
import Application.entity.Result;
import Application.service.DiscussService;

@CrossOrigin	
@RestController
@RequestMapping("/Discuss")
public class DiscussControl {

	
	@Resource
	private DiscussService service;
	
	@PostMapping("/insertDiscuss")
	public Result insertDiscuss(Discuss discuss) {
		return service.insertDiscuss(discuss);
	}
	
	@PostMapping("/findDiscuss")
	public List<Discuss> findDiscussByEssayId(int essayid){
		System.out.println(essayid);
		return service.findDiscussByEssayId(essayid);
	}
	
//	@PostMapping("/findDiscuss")
//	public void findDiscussByEssayId(String essayid) {
//		System.out.println(essayid);
//	}
 }
